package thread;

import java.util.Scanner;

/**
 * @Author Justin Parker
 * @Date 2024/7/20 0020 9:27
 * @Version 1.0
 */
public class ThreadTimeDemo01 {
     static int count;

    public static void main(String[] args){
        System.out.println("请输入一个时间整数，然后进行倒计时操作！");
        Scanner scanner = new Scanner(System.in);
        count = scanner.nextInt();
        new Thread(()-> {
            while (true){
                if (count == 0){
                    System.out.println("倒计时结束！");
                    break;
                }
                System.out.println(count--);
                try{
                    Thread.sleep(1000);
                }catch (InterruptedException e){
                }
            }

        }).start();
    }
}
